﻿<%@ Page Language="C#" MasterPageFile="~/Users/Users.Master" AutoEventWireup="true"
    CodeBehind="OrganizationDetails.aspx.cs" Inherits="Pantry.Web.Users.OrganizationDetails"
    Title="Organization Detail" %>

<%@ Register TagPrefix="uc3" TagName="ListPostcode" Src="~/Users/Controls/ListPostcode.ascx" %>
<%@ Register TagPrefix="uc" TagName="ListContact" Src="~/Users/Controls/ListContact.ascx" %>
<%@ Register TagPrefix="uc" TagName="ListSupporting" Src="~/Users/Controls/ListSupportingMaterial.ascx" %>
<%@ Register TagPrefix="uc" TagName="ListDirectorate" Src="~/Users/Controls/ListDirectorates.ascx" %>
<%@ Register TagPrefix="uc1" TagName="ListTypeOfBusiness" Src="~/Users/Controls/ListTypeOfBusiness.ascx" %>
<%@ Register Src="~/Users/Controls/ListAddress.ascx" TagName="ListAddress" TagPrefix="uc2" %>
<%@ Register TagPrefix="cc" Namespace="SiteUtils" Assembly="CollectionPager" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script type="text/javascript" src="Resources/js/DataTables/jquery.dataTables.min.js"></script>    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="g_12_tienvn" id="table_wTabs">
        <div class="widget_header wwOptions">
            <ul class="w_Tabs">
                <li><a href="#table_wTabs-1" title="Tab 1">Detail 1</a></li>
                <li><a href="#table_wTabs-2" title="Tab 2">Detail 2</a></li>
                <li><a href="#table_wTabs-3" title="Tab 3" id="detail3-tab">Detail 3</a></li>
                <li><a href="#table_wTabs-4" title="Tab 4">Detail 4</a></li>
                <li><a href="#table_wTabs-5" title="Tab 5">Detail 5</a></li>
                <li><a href="#table_wTabs-6" title="Tab 6">BU/Directorates</a></li>
            </ul>
            <div class="top-nav">
                <asp:Button ID="ButtonInActive" runat="server" Text="In-active" CssClass="buttontop"
                    OnClick="ButtonInActiveClick" OnClientClick="return confirm('Do you want to in-active this Organization ?')" />
                <asp:Button ID="ButtonSave" runat="server" Text="Save" CssClass="buttontop" OnClick="ButtonSaveClick"
                    OnClientClick="return validate()" />
                <asp:Button ID="ButtonBack" runat="server" Text="Back" CssClass="buttontop" OnClick="ButtonBackClick" />
            </div>
        </div>
        <div style="clear: both;">
        </div>
        <div class="widget_contents">
            <div id="table_wTabs-1">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div class="ui-tabs-panel ui-widget-content ui-corner-bottom">
                            <div class="widget_contents_tienvn">
                                <div class="g_6_tienvn">
                                    <ul class="title_ul">
                                        <li>Organnisation Name <span style="color: Red">*</span></li>
                                        <li>Organnisation Short Description <span style="color: Red">*</span></li>
                                        <li>Lead Contact</li>
                                        <li>Address Line 1<span style="color: Red">*</span></li>
                                        <li>Address Line 2</li>
                                        <li>Address Line 3</li>
                                        <li>Postcode<span style="color: Red">*</span></li>
                                        <li>City/Town</li>
                                        <li>County</li>
                                        <li>National/Country</li>
                                    </ul>
                                    <ul class="control_ul">
                                        <li>
                                            <asp:HiddenField ID="HiddenFieldName" runat="server" />
                                            <asp:TextBox ID="TextBoxOrgannisationName" runat="server" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxOrgannisationShortDescription" runat="server" TextMode="MultiLine" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxLeadContact" runat="server" CssClass="small_text" Enabled="false" />
                                            <asp:HiddenField ID="HiddenFieldContactId" runat="server" />
                                            <asp:Button ID="ButtonLookupContact" runat="server" Text="Lookup" CssClass="buttonlookup lookupcontact" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxAddress1" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxAddress2" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxAddress3" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxPostcode" runat="server" CssClass="small_text" Enabled="false" />
                                            <asp:HiddenField ID="HiddenFieldAddressId" runat="server" />
                                            <asp:Button ID="ButtonLookupPostcode" runat="server" Text="Lookup" CssClass="buttonlookup lookupPostcode" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxTown" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxCounty" runat="server" /></li>
                                        <li>
                                            <asp:DropDownList ID="DropDownListNational" runat="server" DataTextField="CountryName"
                                                DataValueField="CountryId">
                                            </asp:DropDownList>
                                        </li>
                                    </ul>
                                </div>
                                <div class="g_6_tienvn">
                                    <ul class="title_ul">
                                        <li>Preferred Organization</li>
                                        <li>Expression of Interest</li>
                                        <li>Type of Business<span style="color: Red">*</span></li>
                                        <li>SIC Code</li>
                                        <li>Organnisation Full Description</li>
                                        <li>Phone Number<span style="color: Red">*</span></li>
                                        <li>Fax</li>
                                        <li>Email</li>
                                        <li>Web Address</li>
                                        <li>Charity Number</li>
                                        <li>Company Number</li>
                                    </ul>
                                    <ul class="control_ul">
                                        <li>
                                            <asp:CheckBox ID="CheckBoxPreferred" runat="server" /></li>
                                        <li>
                                            <asp:CheckBox ID="CheckBoxExpression" runat="server" CssClass="changeTab3"
                                               /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxTypeOfBusiness" runat="server" CssClass="small_text" Enabled="false" />
                                            <asp:HiddenField ID="HiddenFieldTypeOfBusinessId" runat="server" />
                                            <asp:Button ID="ButtonLookupTypeOfBusiness" runat="server" Text="Lookup" CssClass="buttonlookup lookupBusiness" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxSicCode" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxFullDescription" runat="server" TextMode="MultiLine" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxPhoneNumber" runat="server" ToolTip="Example: 999-999-9999" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxFax" runat="server" ToolTip="Example: 999-999-9999" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxEmail" runat="server" ToolTip="Example: abc@domain.com" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxWebAddress" runat="server" ToolTip="Example: www.websitename.com" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxCharityNumber" runat="server" /></li>
                                        <li>
                                            <asp:TextBox ID="TextBoxCompanyNumber" runat="server" /></li>
                                    </ul>
                                </div>
                                <label style="color: Red; margin-left: 10px;">
                                    * is required field</label>
                            </div>
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <div class="clear">
                </div>
            </div>
            <div id="table_wTabs-2">
                <div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide ui-tabs-show">
                    <div class="widget_contents_tienvn">
                        <div class="g_6_tungtt">
                            <ul class="title_ul">
                                <li>Organnisation Specialism </li>
                                <li>Service Disabilities Capabilities </li>
                                <li>Service Barriers Capabilities</li>
                                <li>Service Benifits Capabilities</li>
                            </ul>
                            <ul class="control_ul">
                                <li>
                                    <asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListOrgannisationSpecialism" runat="server" CssClass="" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel2" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListServiceDisabilitiesCapabilities" runat="server"
                                            CssClass="simple_form abc" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel3" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListServiceBarriersCapabilities" runat="server" CssClass=" abc" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel4" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListServiceBenifitsCapabilities" runat="server" CssClass=" abc" />
                                    </asp:Panel>
                                </li>
                            </ul>
                        </div>
                        <div class="g_6_tungtt">
                            <ul class="title_ul">
                                <li>Service Personal Cirumstances Capabilities </li>
                                <li>Service Ethnicity Capabilities </li>
                                <li>Accreditation </li>
                            </ul>
                            <ul class="control_ul">
                                <li>
                                    <asp:Panel ID="Panel5" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListServicePersonalCirumstancesCapabilities" runat="server"
                                            CssClass=" abc" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel6" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListServiceEthnicityCapabilities" runat="server" CssClass=" abc" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel7" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListAccreditation" runat="server" CssClass=" abc" />
                                    </asp:Panel>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div id="table_wTabs-3">
                <div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide ui-tabs-show">
                    <div class="widget_contents_tienvn">
                        <div class="g_6_tungtt">
                            <ul class="title_ul">
                                <li>EOI Programmes </li>
                                <li>EOI Service </li>
                            </ul>
                            <ul class="control_ul">
                                <li>
                                    <asp:Panel ID="Panel8" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListEOIProgrammes" runat="server" 
                                            CssClass="simple_form abc" />
                                    </asp:Panel>
                                </li>
                                <li>
                                    <asp:Panel ID="Panel9" runat="server" ScrollBars="Auto" CssClass="tungtt_panel">
                                        <asp:CheckBoxList ID="CheckBoxListEOIService" runat="server" CssClass="abc" />
                                    </asp:Panel>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div id="table_wTabs-4">
                <div class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide ui-tabs-show">
                    <div class="widget_contents_tienvn">
                        <div class="g_12">
                            <div class="widget_header">
                                <h4 class="widget_header_title wwIcon i_16_forms">
                                    Premise</h4>
                            </div>
                            <div class="widget_contents_tienvn">
                                <table class="tables">
                                    <thead>
                                        <tr>
                                            <th>
                                                Premise Name
                                            </th>
                                            <th>
                                                Address
                                            </th>
                                            <th>
                                                Primary Location
                                            </th>
                                            <th>
                                                Phone Number
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <asp:Repeater ID="RepeaterListPremises" runat="server">
                                            <ItemTemplate>
                                                <tr>
                                                    <td>
                                                        <%#Eval("PremiseName")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("Address")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("PrimaryLocation")%>
                                                    </td>
                                                    <td>
                                                        <%#Eval("PhoneNumber")%>
                                                    </td>
                                                </tr>
                                            </ItemTemplate>
                                        </asp:Repeater>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <div class="g_12">
                            <div class="widget_header">
                                <h4 class="widget_header_title wwIcon i_16_forms">
                                    Locate In</h4>
                            </div>
                            <div class="widget_contents_tienvn">
                                <div class="g_6_tienvn">
                                    <ul class="title_ul">
                                        <li>Ward</li>
                                        <li>Borough</li>
                                        <li>Local Authority</li>
                                        <li>Unitary Authority</li>
                                    </ul>
                                    <ul class="control_ul">
                                        <li>
                                            <asp:TextBox ID="TextBoxWard" runat="server" Enabled="false" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxBorough" runat="server" Enabled="false" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxLocalAuthority" runat="server" Enabled="false" />
                                        </li>
                                        <li>
                                            <asp:TextBox ID="TextBoxUnitaryAuthority" runat="server" Enabled="false" />
                                        </li>
                                    </ul>
                                </div>
                                <div class="g_6_tienvn">
                                    <ul class="title_ul">
                                        <li>NHS Authority</li>
                                        <li>Gov't Office Region</li>
                                        <li>Trust Region</li>
                                        <li>Trust District</li>
                                    </ul>
                                    <ul class="control_ul">
                                        <li>
                                            <asp:TextBox ID="TextBoxNHSAuthority" runat="server" Enabled="false" />
                                        </li>
                                        <li>
                                            <asp:DropDownList ID="DropDownListGovOfficeRegion" runat="server" DataTextField="GovOfficeRegionName"
                                                DataValueField="GovOfficeRegionId">
                                            </asp:DropDownList>
                                        </li>
                                        <li>
                                            <asp:DropDownList ID="DropDownListTrustRegion" runat="server" DataTextField="TrustRegionName"
                                                DataValueField="TrustRegionId">
                                            </asp:DropDownList>
                                        </li>
                                        <li>
                                            <asp:DropDownList ID="DropDownListTrustDistrict" runat="server" DataTextField="TrustDistrictName"
                                                DataValueField="TrustDistrictId">
                                            </asp:DropDownList>
                                        </li>
                                    </ul>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="clear">
                </div>
            </div>
            <div id="table_wTabs-5">
                <uc:ListSupporting runat="server"></uc:ListSupporting>
                <div class="clear">
                </div>
            </div>
            <div id="table_wTabs-6">
                <uc:ListDirectorate runat="server" ID="ListDirectorate" />
                <div class="clear">
                </div>
            </div>
        </div>
    </div>
    <div class="dialog DialogListOfBusiness" style="display: none;" title="Lookup Type Of Business">
        <uc1:ListTypeOfBusiness runat="server" ID="ListTypeOfBusiness" />
        <div class="clear">
        </div>
    </div>
    <div class="dialog DialogAddress" style="display: none;" title="Lookup Address">
        <uc2:ListAddress runat="server" ID="ListAddress" />
        <div class="clear">
        </div>
    </div>
    <div class="dialog DialogListContact" style="display: none;" title="Lookup Contact">
        <uc:ListContact runat="server" ID="ListContact" />
        <div class="clear">
        </div>
    </div>
    <div class="dialog DialogListOfPostCode" style="display: none;" title="Lookup Type Postcode">
        <uc3:ListPostcode runat="server" ID="ListPostcode" />
        <div class="clear">
        </div>
    </div>

    <script language="javascript" type="text/javascript">
        function validate() {
            if (document.getElementById("<%=TextBoxOrgannisationName.ClientID%>").value == "") {
                showmessage('Please input Organnisation name !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxOrgannisationName.ClientID%>").focus();
                return false;
            } if (document.getElementById("<%=TextBoxAddress1.ClientID%>").value == "") {
                showmessage('Please input address !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxAddress1.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=TextBoxOrgannisationShortDescription.ClientID%>").value == "") {
                showmessage('Please input short description !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxOrgannisationShortDescription.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=TextBoxPostcode.ClientID%>").value == "") {
                showmessage('Please input post code !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxPostcode.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=TextBoxLeadContact.ClientID%>").value == "") {
                showmessage('Please select lead contact !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxLeadContact.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=TextBoxTypeOfBusiness.ClientID%>").value == "") {
                showmessage('Please select type of business !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxTypeOfBusiness.ClientID%>").focus();
                return false;
            }
            if (document.getElementById("<%=TextBoxPhoneNumber.ClientID%>").value != "") {
                var phone = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
                var phoneid = document.getElementById("<%=TextBoxPhoneNumber.ClientID %>").value;
                var matchArray = phoneid.match(phone);
                if (matchArray == null) {
                    showmessage('Phone number is invalid format !', 'ERROR', '', 'false');
                    document.getElementById("<%=TextBoxPhoneNumber.ClientID %>").focus();
                    return false;
                }
            }
            if (document.getElementById("<%=TextBoxFax.ClientID%>").value != "") {
                var phone = /^\(?(\d{3})\)?[- ]?(\d{3})[- ]?(\d{4})$/;
                var phoneid = document.getElementById("<%=TextBoxFax.ClientID %>").value;
                var matchArray = phoneid.match(phone);
                if (matchArray == null) {
                    showmessage('Fax number is invalid format !', 'ERROR', '', 'false');
                    document.getElementById("<%=TextBoxPhoneNumber.ClientID %>").focus();
                    return false;
                }
            }
            if (document.getElementById("<%=TextBoxEmail.ClientID %>").value != "") {
                var emailPat = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
                var emailid = document.getElementById("<%=TextBoxEmail.ClientID %>").value;
                var matchArray = emailid.match(emailPat);
                if (matchArray == null) {
                    showmessage('Email is invalid format !', 'ERROR', '', 'false');
                    document.getElementById("<%=TextBoxEmail.ClientID %>").focus();
                    return false;
                }
            }

            if (document.getElementById("<%=TextBoxWebAddress.ClientID %>").value == "") {
                showmessage('Please input web address !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxWebAddress.ClientID %>").value = "http://"
                document.getElementById("<%=TextBoxWebAddress.ClientID %>").focus();
                return false;
            }
            var Url = "^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"
            var tempURL = document.getElementById("<%=TextBoxWebAddress.ClientID%>").value;
            var matchURL = tempURL.match(Url);
            if (matchURL == null) {
                showmessage('Web URL does not look valid !', 'ERROR', '', 'false');
                document.getElementById("<%=TextBoxWebAddress.ClientID %>").focus();
                return false;
            }
            return true;
        }
    </script>

</asp:Content>
